<?php
	class Modules_Projects_Model_ChangeDefault
	{
		public $result=array("error"=>"","result"=>0);
		public function Modules_Projects_Model_ChangeDefault($args=null)
		{
			try{
			if($args==null)
				return;
					
				$user=new Modules_Common_DB_Users($_SESSION['id']);
				if(!Modules_Common_DB_RTUserProject::PermissionOnProject($_SESSION['id'], $args['project']))
				{
					$this->result["result"]=0;
					$this->result["error"]="Don't have permissions to work on this project";
					return;
				}	
				
				$user->LastProject=$args['project'];
				$user->Save();	
				$_SESSION['project']=$args['project'];
				$this->result["result"]=1;
			}
			catch(Exception $e)
			{
				$this->result["result"]=0;
				$this->result["error"]="Success Creating new Project";
			}
		}
		public function Init()
		{
			
		}
	}
	?>